<template>
  <div class="face-entrance-detail">
    <descriptions :columns="columns" :data-source="dataSource" :col-span="24" />
  </div>
</template>

<script>
import { getEnumText } from '@gis/lib/enums/index.js';
import { devDetails } from '@gis/lib/api';

export default {
  name: 'face-entrance-detail',
  components: {},
  props: {
    detail: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      dataSource: {},
      columns: [
        { label: '门禁名称', key: 'door_name' },
        { label: '序列号', key: 'identification', colSpan: 24 },
        {
          label: '门禁类型',
          key: 'door_type',
          format: (v) => {
            let str = getEnumText('doorType', v);
            return str;
          },
          colSpan: 24,
        },
        { label: '门禁方向', key: 'access_type', format: (v) => getEnumText('access_type', v) },
        { label: '经度', key: 'longitude' },
        { label: '纬度', key: 'latitude' },
        { label: '是否激活', key: 'activate_status', format: (v) => getEnumText('whetherOrNot', v) },
        { label: '是否在线', key: 'is_online', format: (v) => (v ? '在线' : '离线') },
        { label: '设备编号', key: 'device_no' },
        { label: '省级ai设备编号', key: 'ai_no' },
        { label: '继电器设备', key: 'relay_guid' },
        { label: '创建人', key: 'creator_name' },
        { label: '创建时间', key: 'create_time', colSpan: 24 },
        { label: '更新时间', key: 'modify_time', colSpan: 24 },
        { label: '备注', key: 'remark' },
      ],
    };
  },
  created() {
    this.getDevDetails();
  },
  methods: {
    async getDevDetails() {
      const data = this.handleCommonResult(await devDetails(this.detail.id));
      this.dataSource = data || {};
    },
  },
};
</script>

<style scoped lang="less">
.face-entrance-detail {
}
</style>
